<style>
    .layui-form-label.required:before { /* 这种写法也可以*/
        content: ' *';
        color: red;
    }
    .open-form .layui-form-label {
        width: 110px;
    }
    .open-form .layui-input-block{
        margin-left: 140px;
    }
</style>

<script type="text/html" id="viewAttachmentHtml">
    <div id="example1" style="height: 100%;"></div>
</script>
<script type="text/javascript" src="../../../admin/assets/js/pdfobject.min.js"></script>
<!-- 表单弹窗 -->
<form lay-filter="productReviewForm" class="layui-form open-form">
    <input name="id" type="hidden"/>
    <div class="open-model">
        <div class="open-auto" style="padding-left: 15px">
            <fieldset class="layui-elem-field layui-field-title">
                <legend>客户信息产品信息</legend>
            </fieldset>

            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label required">客户名称：</label>
                    <div class="layui-input-block">
                        <select id="customerId" lay-search="" name="customerId" lay-filter="customerId"
                                class="common-select-search">
                        </select>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label required">客户SKU料号：</label>
                    <div class="layui-input-block">
                        <select id="cusSkuCode" lay-search="" name="cusSkuCode" lay-filter="cusSkuCode"
                                class="common-select-search">
                        </select>
                    </div>
                </div>

                <div class="layui-col-md3">
                    <label class="layui-form-label">客户产品类别：</label>
                    <div class="layui-input-block">
                        <input name="cusProductCategory" placeholder="请输入产品类别" type="text" class="layui-input"
                               required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label required">客户产品名称：</label>
                    <div class="layui-input-block">
                        <input name="cusProductName" placeholder="请输入产品名称" type="text" class="layui-input"
                               lay-verify="required"
                               required autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label">客户规格码：</label>
                    <div class="layui-input-block">
                        <input name="cusProductSpec" placeholder="请输入规格码" type="text" class="layui-input"
                               required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label required">计量单位：</label>
                    <div class="layui-input-block">
                        <input name="cusProductSpec" placeholder="请输计量单位" type="text" class="layui-input"
                               lay-verify="required"
                               required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">需求数量：</label>
                    <div class="layui-input-block">
                        <input name="cusProductCount" placeholder="请输需求数量" type="text" class="layui-input"
                               required autocomplete="off"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">包装说明：</label>
                    <div class="layui-input-block">
                        <input name="remark" placeholder="说明" type="text" class="layui-input"
                               autocomplete="off"/>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label">上传图纸附件：</label>
                    <div class="layui-input-block">
                        <div id="fileUploadBtn" class="layui-btn" style="float: left;margin-left: 3px"><i class="layui-icon">&#xe681;</i>上传文件
                        </div>
                        <br/>
                        <div id="addHeaderPdf" class="companyFormPhotos"></div>
                        <input name="attachmentPdf" id="attachmentPdf" type="hidden" class="layui-input"
                               lay-verify="attachmentPdf"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label required">计划交货时间：</label>
                    <div class="layui-input-block">
                        <input type="text" id="planGivenTime" name="planGivenTime" class="layui-input"
                               placeholder="请选择计划交货时间">
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">工艺说明：</label>
                    <div class="layui-input-block">
                        <input type="text" id="processDescription" name="processDescription" class="layui-input"
                               placeholder="工艺说明">
                    </div>
                </div>
            </div>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>关联内部产品信息</legend>
            </fieldset>

            <div class="layui-form-item layui-row">

                <div class="layui-col-md3">
                    <label class="layui-form-label required">是否关联料号：</label>
                    <div class="layui-input-block">
                        <select id="isUseOrAdd" name="isUseOrAdd" lay-filter="isUseOrAdd"
                                class="common-select-search">
                            <option value="">请选择</option>
                            <option value="1">创建新产品</option>
                            <option value="2">关联已有产品</option>
                        </select>
                    </div>
                </div>

                <div class="layui-col-md3">
                    <label class="layui-form-label required">内部SKU号：</label>
                    <div class="layui-input-block" id="SkuInfo">
                        <div id="d1">
                            <input type="text" id="inSkuCode" name="inSkuCode" class="layui-input"
                                   placeholder="请输入SKU号">
                        </div>
                        <div id="d2" style="display: none;">
                            <select id="inSkuCodeHave" name="inSkuCodeHave" lay-filter="inSkuCodeHave"
                                    class="common-select-search">
                            </select>
                        </div>
                    </div>
                </div>

                <div class="layui-col-md3">
                    <label class="layui-form-label required">产品类别：</label>
                    <div class="layui-input-block">
                        <div id="productTypeName" lay-filter="productTypeName">
                        </div>
                        <input type="text" class="layui-input" id="productTypeId" name="productTypeId" style="display: none">
                        <input type="text" class="layui-input" id="productTypeId2" name="productTypeId2" style="display: none">
                    </div>
                </div>

                <div class="layui-col-md3">
                    <label class="layui-form-label required">产品性质：</label>
                    <div class="layui-input-block">
                        <select id="productNature" name="productNature" lay-filter="productNature" class="common-select-search">
                        </select>
                    </div>
                </div>

            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label required">内部SKU名称：</label>
                    <div class="layui-input-block">
                        <input type="text" id="inSkuName" name="inSkuName" class="layui-input"
                               placeholder="请输入名称">
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">内部规格码：</label>
                    <div class="layui-input-block">
                        <input type="text" id="inSkuSpec" name="inSkuSpec" class="layui-input"
                               placeholder="请输入名称">
                    </div>
                </div>
                <!--        <div class="layui-col-md3">-->
                <!--            <label class="layui-form-label required">计量单位：</label>-->
                <!--            <div class="layui-input-block">-->
                <!--                <select id="inSkuUnit" name="inSkuUnit" class="layui-input" class="common-select-search"></select>-->
                <!--            </div>-->
                <!--        </div>-->
                <div class="layui-col-md3">
                    <label class="layui-form-label required">基础单位：</label>
                    <div class="layui-input-block">
                        <input type="text" disabled id="inUnit" name="inUnit" class="layui-input">
                        <input type="hidden"  id="inUnitId" name="inUnitId" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label required">计量方式(主)：</label>
                    <div class="layui-input-block">
                        <select id="mainCalWay" name="mainCalWay" lay-filter="mainCalWay"
                                class="layui-input borderNone"></select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label required">包装单位(主)：</label>
                    <div class="layui-input-block">
                        <select id="mainUnitId" name="mainUnitId" lay-filter="mainUnitId"
                                class="layui-input borderNone"></select>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label required">换算率(主)：</label>
                    <div class="layui-input-block">
                        <input type="text" id="mainUnitRate" name="mainUnitRate" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">计量方式(辅)：</label>
                    <div class="layui-input-block">
                        <select id="subCalWay" name="subCalWay" lay-filter="subCalWay"
                                class="layui-input borderNone"></select>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">计量单位(辅)：</label>
                    <div class="layui-input-block">
                        <select id="subUnitId" name="subUnitId" lay-filter="mainUnitId"
                                class="layui-input borderNone"></select>
                    </div>
                </div>

                <!--        <div class="layui-col-md3">-->
                <!--            <label class="layui-form-label required">基础单位数量：</label>-->
                <!--            <div class="layui-input-block">-->
                <!--                <input type="text" id="inUnitCount" name="inUnitCount" class="layui-input"-->
                <!--                       placeholder="数量">-->
                <!--            </div>-->
                <!--        </div>-->

            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label">换算率(辅)：</label>
                    <div class="layui-input-block">
                        <input type="text" id="subUnitRate" name="subUnitRate" class="layui-input">
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">成本核算类型：</label>
                    <div class="layui-input-block">
                        <select id="costCheckType" name="costCheckType" lay-filter="costCheckType"
                                class="layui-input borderNone"></select>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">是否质检：</label>
                    <div class="layui-input-block">
                        <select id="checkStatus" name="checkStatus" lay-filter="checkStatus"
                                class="layui-input borderNone"></select>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">是否料箱管理：</label>
                    <div class="layui-input-block">
                        <select id="boxStatus" name="boxStatus" lay-filter="boxStatus"
                                class="layui-input borderNone"></select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label">建议最低价：</label>
                    <div class="layui-input-block">
                        <input name="suggestionMinPrice" id="suggestionMinPrice"  type="text" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">最低价：</label>
                    <div class="layui-input-block">
                        <input name="minPrice" id="minPrice" type="text" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">说明：</label>
                    <div class="layui-input-block">
                        <input type="text" id="inRemark" name="inRemark" class="layui-input">
                    </div>
                </div>
            </div>
            <fieldset class="layui-elem-field layui-field-title">
                <legend>审核信息</legend>
            </fieldset>
            <div class="layui-form-item layui-row">
                <div class="layui-col-md3">
                    <label class="layui-form-label required">评估结果：</label>
                    <div class="layui-input-block">
                        <select id="result-sh" name="result" lay-filter="result"
                                class="common-select-search">
                            <option value="">请选择</option>
                            <option value="0">审核不通过</option>
                            <option value="1">审核通过</option>
                        </select>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <label class="layui-form-label">评估备注：</label>
                    <div class="layui-input-block">
                        <input type="text" id="reviewDesc" name="reviewDesc" class="layui-input">
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item text-right">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="productReviewRecordFormSubmit" lay-submit>保存</button>
        </div>
    </div>
</form>

<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'laydate', 'admin', 'laytpl', 'upload', 'config'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var config = layui.config;
        var upload = layui.upload;
        var table = layui.table;
        var admin = layui.admin;
        var form = layui.form;
        var laydate = layui.laydate;

        let oldSkuInfo = new Map()

        let customerName = "";
        let postName = "";
        let productUnitList = [];

        let fileName = "";

        //加载是默认填写
        document.getElementById("d2").style.display = "none";//隐藏
        document.getElementById("d1").style.display = "";//显示

        admin.getDictList("mainCalWay", "product_unit_cal_way", null, "辅助计量方式");
        admin.getDictList("subCalWay", "product_unit_cal_way", null, "主计量方式");

        admin.getDictList("costCheckType", "product_detail_cost_check_type", null, "成本核算");
        admin.getDictList("checkStatus", "sys_yes_no", null, "是否质检");
        admin.getDictList("boxStatus", "sys_yes_no",null, "是否料箱管理");

        // 上传附件-pdf
        upload.render({
            elem: '#fileUploadBtn'
            , url: config.upload_url + 'uploadFile'
            , data: {}
            , accept: 'file'
            , exts: 'jpg|png|RAR|zip|pdf|txt|doc|docx|xls|xlsx|ppt|pptx'
            , headers: {Authorization: 'Bearer ' + config.getToken()}
            , done: function (res) {
                if (res.code == 200) {
                    layer.msg(res.msg || "上传成功", {icon: 1});
                    let imagUrl = res.data.url;
                    let name = res.data.fileName;
                    fileName = res.data.fileName;
                    $('#addHeaderPdf').html('<div class="attachments">' +
                        '<div style="margin-top: 30px;margin-left: 32px"><img name="attachments" src="../../../admin/assets/images/attachmentsIcon/pdf.png"><span class="file-a">' + name + '</span></div></div>');
                    $('#attachmentPdf').val(imagUrl);

                    $(".attachments").click(function () {
                        let json = {};
                        json.attachment = imagUrl;
                        showViewAttachmentModel(json);
                    })
                } else if (res.code == 502) {
                    return location.replace('admin/login.html');
                } else {
                    layer.msg(res.msg || "上传失败", {icon: 2});
                }
            }
        });

        form.on('select(mainCalWay)', function (data) {
            $('#mainUnitId').empty();
            if (data.value) {
                productUnitList.forEach(v => {
                    if (v.calWay == data.value) {
                        $('#mainUnitId').append(new Option(v.name, v.id));// 下拉菜单里添加元素
                    }
                })
            }
            form.render("select");
        })

        form.on('select(subCalWay)', function (data) {
            $('#subUnitId').empty();
            if (data.value) {
                productUnitList.forEach(v => {
                    if (v.calWay == data.value) {
                        $('#subUnitId').append(new Option(v.name, v.id));// 下拉菜单里添加元素
                    }
                })
            }
            form.render("select");
        })



        //是否关联旧SKU选择事件
        form.on('select(isUseOrAdd)', function (data) {
            let val = data.value;
            ;
            if (val == 1) {
                document.getElementById("d2").style.display = "none";//隐藏
                document.getElementById("d1").style.display = "";//显示
                setNoEdit("0")
            } else {
                document.getElementById("d2").style.display = "";//隐藏
                document.getElementById("d1").style.display = "none";//显示
                setNoEdit("1")
            }
            clearInfo();
        })

        function clearInfo() {
            $("#inSkuSpec").val("");
            $("#inSkuCodeHave").val("");
            $("#productNature").val("");
            xmSelect.get('#productTypeName')[0].setValue([])
            $("#inSkuName").val("");
            $("#mainUnitRate").val("");
            $("#subCalWay").val("");
            $("#mainCalWay").val("");
            $("#subUnitRate").val("");
            $("#costCheckType").val("");
            $("#boxStatus").val("");
            $("#checkStatus").val("");
            $("#mainUnitId").val("");
            $("#subUnitId").val("");
            $("#inRemark").val("");
            $("#inUnit").val("");
            $("#minPrice").val("");
            $("#suggestionMinPrice").val("");
            $("#inUnitId").val("");
            form.render('select');
        }


        let selectMap;

        //customerId
        form.on('select(customerId)', function (data) {
            $("#cusSkuCode").empty();
            customerName = data.elem.selectedOptions[0].text;
            let customerId = data.value;
            //查询客户下的sku料号
            admin.initDataSelectAndMap("enterprise/sell/admin/customerProductCatalog/list", {limit: 9999,customerId:customerId,isHaveInSku:1}, "cusSkuCode", null, "外部产品", "cusProductName", "cusProductId", selectMap);

            form.on('select(cusSkuCode)',function (data){
                let value = data.value;
                let newVar = selectMap.get(value);
                $("#cusProductCategory").val(newVar.proTypeName);
                $("#cusProductName").val(newVar.cusProductName);
                $("#cusProductSpec").val(newVar.cusProductSpec);
                $("#proUnitName").val(newVar.proUnitName);

            });

        });

        function setNoEdit(s) {
            let isCan = false;
            //设置为可选
            if (s==="1"){
                isCan = true;
            }
            xmSelect.get('#productTypeName')[0].update({ disabled: isCan })
            document.getElementById("inSkuName").disabled = isCan;
            document.getElementById("inSkuSpec").disabled = isCan;
            document.getElementById("productNature").disabled = isCan;
            document.getElementById("mainUnitRate").disabled = isCan;
            document.getElementById("subCalWay").disabled = isCan;
            document.getElementById("mainCalWay").disabled = isCan;
            document.getElementById("subUnitRate").disabled = isCan;
            document.getElementById("costCheckType").disabled = isCan;
            document.getElementById("boxStatus").disabled = isCan;
            document.getElementById("checkStatus").disabled = isCan;
            document.getElementById("mainUnitId").disabled = isCan;
            document.getElementById("subUnitId").disabled = isCan;
            document.getElementById("inRemark").disabled = isCan;
            form.render("select")
        }

        // 已有物料的选择事件
        form.on('select(inSkuCodeHave)', function (data) {
            let val = data.value;
            let skuInfo = {};
            if (oldSkuInfo.get(val)) {
                skuInfo = oldSkuInfo.get(val);
                //回显

                admin.reqSync('enterprise/product/admin/productUnit/getIsBaseUnitProductUnitByType', {
                    type: 0,
                    productTypeId: skuInfo.productTypeId
                }, res => {
                    if (res.code === 200) {
                        if (res.data != null) {
                            let infoName = res.data.name || '';
                            let infoId = res.data.id || '';
                            $('#inUnit').val(infoName);
                            $('#inUnitId').val(infoId);
                        }else{
                            $('#inUnit').val("");
                            $('#inUnitId').val("");
                        }
                    }
                }, 'get');

                //主计量方式的改变事件
                admin.req('enterprise/product/admin/productType/getProductTypeVoById', {productTypeId: skuInfo.productTypeId}, (res) => {
                    if (res.code === 200) {
                        //包装单位集合
                        productUnitList = res.data.productUnitList
                        productUnitList.forEach(v => {
                            if (v.calWay == skuInfo.subCalWay) {
                                $('#subUnitId').append(new Option(v.name, v.id));// 下拉菜单里添加元素
                            }
                        })

                        productUnitList.forEach(v => {
                            if (v.calWay == skuInfo.mainCalWay) {
                                $('#mainUnitId').append(new Option(v.name, v.id));// 下拉菜单里添加元素
                            }
                        })
                        form.render('select');
                        $('#mainUnitId').val(skuInfo.mainUnitId);
                        $('#subUnitId').val(skuInfo.subUnitId);
                    }
                });

                //初始化成本核算 计量方式...
                $('#mainCalWay').val(skuInfo.mainCalWay);

                $('#mainUnitRate').val(skuInfo.mainUnitRate);
                $('#subCalWay').val(skuInfo.subCalWay);

                $('#subUnitRate').val(skuInfo.subUnitRate);
                $('#costCheckType').val(skuInfo.costCheckType);
                $('#checkStatus').val(skuInfo.checkStatus);
                $('#boxStatus').val(skuInfo.boxStatus);
                $('#minPrice').val(skuInfo.minPrice);
                $('#suggestionMinPrice').val(skuInfo.suggestionMinPrice);

                //sku名称
                $('#inSkuName').val(skuInfo.skuName);
                //规格
                $('#inSkuSpec').val(skuInfo.skuSpec);
                //计量单位
                // $('#inSkuUnit').val(skuInfo.unitId);

                $('#productTypeId2').val(skuInfo.productTypeId);
                //基础单位数量
                // $('#inUnitCount').val(skuInfo.baseUnitCount);
                //产品类别
                admin.initDataSelectTree(true, 'enterprise/product/admin/productType/getTreeData', {materialNatureList: [2, 3 ,7]}, 'productTypeName', skuInfo.productTypeId, "物料分类", "productTypeId",null);

                //产品性质
                $('#productNature').val(skuInfo.assemblyNature);

                //说明
                $('#inRemark').val(skuInfo.remark);

                xmSelect.get('#productTypeName')[0].update({ disabled: true })
                form.render("select")
            }
        });

        //物料类型
        admin.initDataSelectTree(true, 'enterprise/product/admin/productType/getTreeData', {materialNatureList: [2, 3 ,7]}, 'productTypeName', null, "物料分类", "productTypeId", function(data){
            let productTypeId = data.change[0].value;
            //主计量方式的改变事件
            admin.req('enterprise/product/admin/productType/getProductTypeVoById', {productTypeId: productTypeId}, (res) => {
                if (res.code === 200) {
                    //包装单位集合
                    productUnitList = res.data.productUnitList
                }
            });

            //基础单位
            admin.reqSync('enterprise/product/admin/productUnit/getIsBaseUnitProductUnitByType', {
                type: 0,
                productTypeId: productTypeId
            }, res => {
                if (res.code === 200) {
                    if (res.data != null) {
                        let infoName = res.data.name || '';
                        let infoId = res.data.id || '';
                        $('#inUnit').val(infoName);
                        $('#inUnitId').val(infoId);
                    }else{
                        $('#inUnit').val("");
                        $('#inUnitId').val("");
                    }
                }
            }, 'get');
        });

        // 查看附件
        function showViewAttachmentModel(data) {
            admin.open({
                type: 1,
                area: ['60%', '80%'],
                offset: '65px',
                title: '查看附件',
                content: $('#viewAttachmentHtml').html(),
                success: function () {
                    if (data.attachment && data.attachment.indexOf(".pdf") !== -1) {
                        PDFObject.embed(data.attachment, "#example1");
                    } else {
                        var attachmentHtml = "";
                        data.attachment.split(",").forEach((attachmentUrl, index) => {
                            attachmentHtml += '<div><div><img src="' + attachmentUrl + '"></div></div>';
                        });
                        $('#example1').html(attachmentHtml);
                    }
                }
            })
        }

        let subjectId = "";

        //初始化客户名称
        // admin.initDataSelect("enterprise/sell/admin/customersInfo/getBasicInfo", {customerType:"2,3"}, "customerId", null, "客户信息", "customerName","id");

        //初始化客户名称
        admin.req('enterprise/sell/admin/customersInfo/getBasicInfo', {customerType: "2,3"}, function (res) {
            console.log(res.data);
            if (200 == res.code) {

                $("form select[name='customerId']").append(new Option("请选择客户", ""));//往下拉菜单里添加元素
                $.each(res.data, function (index, item) {
                    $("form select[name='customerId']").append(new Option(item.customerName, item.id));//往下拉菜单里添加元素
                })
                $("form select[name='customerId']").val(subjectId);
                form.render(); //菜单渲染 把内容加载进去
            } else {
                layer.msg('获取客户失败!', {icon: 2, time: 1000});
            }
        }, 'GET');

        // //物料类型
        // admin.initDataSelectTree(true, 'enterprise/product/admin/productType/getTreeData', {materialNatureList: [2, 3,7]}, 'productTypeName', null, "物料分类", "productTypeId", null);

        //产品性质
        admin.getDictList("productNature", "product_assembly_nature", null, "产品性质");

        // //计量单位
        // admin.getDictList("inSkuUnit", "sys_product_detail_calculate_unit", null, "计量单位");

        //基础单位
        admin.getDictList("inUnit", "sys_product_detail_base_unit", null, "基础单位");

        // Sku老数据信息
        admin.initDataSelectAndMap("enterprise/product/admin/productDetailWMS/list", {limit:9999,categoryType: "production"}, "inSkuCodeHave", null, "SKU物料", "skuCode", null, oldSkuInfo);

        //表单提交事件
        form.on('submit(productReviewRecordFormSubmit)', function (d) {
            layer.load(2);

            d.field.customerName = customerName;
            d.field.fileName = fileName;
            d.field.reviewProcessId = "1";
            if (d.field.productTypeId == null){
                d.field.productTypeId = $("#productTypeId2").val();
            }
            admin.req('enterprise/product/admin/productRecordReview/add', d.field, function (res) {
                layer.closeAll('loading');
                if (res.code == 200) {
                    layer.msg(res.msg, {icon: 1});
                    table.reload('reviewTableInfo');
                    layer.closeAll('page');
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'POST');
            return false;
        });

        //时间选择器
        laydate.render({
            elem: '#reviewEndTime'
            , type: 'datetime'
        });

        laydate.render({
            elem: '#planGivenTime'
            , type: 'datetime'
        });

    });
</script>